import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:interview/config/app.enum.dart';
import 'package:interview/controller/navigation_controller.dart';
import 'package:interview/theme/app_colors.dart';

class SearchBox extends StatelessWidget {
  const SearchBox({super.key});

  @override
  Widget build(BuildContext context) {
    final navigation = Get.find<NavigationController>();

    final theme = Theme.of(context).extension<AppColors>()!;
    return GestureDetector(
      onTap: () {
        navigation.push("/searchpage");
      },
      child: Container(
        margin: const EdgeInsets.symmetric(horizontal: 16),
        padding: const EdgeInsets.symmetric(vertical: 3),
        decoration: BoxDecoration(
          color: theme.subjectMix2!,
          borderRadius: BorderRadius.circular(12), // 设置圆角
        ),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                SvgPicture.asset(
                  '${AppEnumAssets.basePath}ic_common_search.svg',
                  width: 14,
                  height: 14,
                  colorFilter: ColorFilter.mode(
                    theme.contrastPure!, // 使用主题颜色
                    BlendMode.srcIn, // 适配颜色覆盖
                  ),
                ),
                Padding(
                    padding: const EdgeInsets.only(left: 8),
                    child: Text("搜索", style: TextStyle(color: theme.contrastMix1!)))
              ],
            )
          ],
        ),
      )
    );
  }
}
